/*==========================
TOUCHY SCROLL FOR SIDEBAR
==========================*/
$("#sidebar").niceScroll({
    cursorcolor: "#2f2e2e",
    cursoropacitymax: 0.7,
    boxzoom: false,
    touchbehavior: true
});


$(function () {
	/**============
	 * Menu accordion(Left)
	 **============*/
	$('.accordion_mnu').initMenu({
		type:'click'  // event
	});

	/*===================
	LIST-ACCORDION
	===================
	$('#list-accordion').accordion({
		header: ".title",
		autoheight: false
	});*/

	/*===================
	JQUERY UNIFORM
	===================*/
	$(".checkbox-b,.rem_me,.radio-b,input[type='file']").uniform();
});


/*======================
DATA TABLE
========================*/
$(function () {
    $('.data-tbl-simple').dataTable({
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sLengthMenu": "<span class='lenghtMenu'> _MENU_</span><span class='lengthLabel'>Entries per page:</span>",
        },
        "sDom": '<"table_top clearfix"fl<"clear">>,<"table_content"t>,<"table_bottom"p<"clear">>'

    });
    $("div.table_top select").addClass('tbl_length');
	/*
	$(".tbl_length").chosen({
		disable_search_threshold: 4
	});
	*/
});

$(function () {
    $('.data-tbl-inbox').dataTable({
			 "aoColumnDefs": [
						{ "bSortable": false, "aTargets": [ 0,1 ] }
					],
					"aaSorting": [[1, 'asc']],
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sLengthMenu": "<span class='lenghtMenu'> _MENU_</span><span class='lengthLabel'>Message per page:</span>",
        },
        "sDom": '<"table_top clearfix"fl<"clear">>,<"table_content"t>,<"table_bottom"p<"clear">>'

    });
    $("div.table_top select").addClass('tbl_length');
	$(".tbl_length").chosen({
		disable_search_threshold: 4
	});

});

$(function () {
    $('.data-tbl-striped').dataTable({
			 "aoColumnDefs": [
						{ "bSortable": false, "aTargets": [ 0,1,7 ] }
					],
					"aaSorting": [[1, 'asc']],
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sLengthMenu": "<span class='lenghtMenu'> _MENU_</span><span class='lengthLabel'>Message per page:</span>",
        },
        "sDom": '<"table_top clearfix"fl<"clear">>,<"table_content"t>,<"table_bottom"p<"clear">>'

    });

    $("div.table_top select").addClass('tbl_length');

	$(".tbl_length").chosen({
		disable_search_threshold: 4
	});

});

$(function () {
    $('.data-tbl-boxy').dataTable({
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sLengthMenu": "<span class='lenghtMenu'> _MENU_</span><span class='lengthLabel'>Entries per page:</span>",
        },
        "sDom": '<"tbl-searchbox clearfix"fl<"clear">>,<"table_content"t>,<"widget-bottom"p<"clear">>'

    });
    $("div.tbl-searchbox select").addClass('tbl_length');
	/*
	$(".tbl_length").chosen({
		disable_search_threshold: 4
	});
	*/

});



$(function () {

    $('.data-tbl-tools').dataTable({
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sLengthMenu": "<span class='lenghtMenu'> _MENU_</span><span class='lengthLabel'>Entries per page:</span>",
        },
        "sDom": '<"tbl-tools-searchbox"fl<"clear">>,<"tbl_tools"CT<"clear">>,<"table_content"t>,<"widget-bottom"p<"clear">>',

        "oTableTools": {
            "sSwfPath": "swf/copy_cvs_xls_pdf.swf"
        }
    });
    $("div.tbl-tools-searchbox select").addClass('tbl_length');
	/*
	$(".tbl_length").chosen({
        disable_search_threshold: 4
    });
	*/
});




/*===================================
THEME SWITCHER
=====================================*/
$(function(){

	$('#sidebar-off').click(function(){
		$(this).attr('disabled','disabled');
		$(this).siblings('button').removeAttr('disabled');
		$('#sidebar').addClass('side-hide');
		$('.top-nav').addClass('full-fluid');
		$('#main-content').addClass('full-fluid');
	});

	$('#sidebar-on').click(function(){
		$(this).attr('disabled','disabled');
		$(this).siblings('button').removeAttr('disabled');
		$('#sidebar').removeClass('side-hide');
		$('.top-nav').removeClass('full-fluid');
		$('#main-content').removeClass('full-fluid');
	});

	$('#right-sidebar').click(function(){
		$(this).attr('disabled','disabled');
		$(this).siblings('button').removeAttr('disabled');
		$('#sidebar').addClass('right-sidebar');
		$('.top-nav').addClass('merge-left');
		$('#main-content').addClass('merge-left');
	});

	$('#left-sidebar').click(function(){
		$(this).attr('disabled','disabled');
		$(this).siblings('button').removeAttr('disabled');
		$('#sidebar').removeClass('right-sidebar');
		$('.top-nav').removeClass('merge-left');
		$('#main-content').removeClass('merge-left');

	});
});


$(function() {
	$('.theme-color').click(function(){
		var stylesheet = $(this).attr('title').toLowerCase();
		$('#themes').attr('href','css'+'/'+stylesheet+'.css');
	});
});